﻿/*****************************************介绍*****************************************
 * 作者：24531
 * 创建时间：2025-09-04 23:25:35
 * 功能：界面【LevelFailurePanel】的View
        1、负责收集所有控件
**************************************************************************************/

using Game.Framework;

namespace Game.UI.LevelFailurePanel
{
    public class LevelFailurePanelView : ItemPanelView
    {
        public const string PANEL_KEY = "Game_UI_LevelFailurePanel_LevelFailurePanel_Key";
        
        public override void Init(object data)
        {
            base.Init(data);
            AudioManager.Instance.PlayAudio("Audios/LevelFailed");
        }

        protected override ETriggerAdType GetAdTriggerType() => ETriggerAdType.Revival;

        protected override string GetPanelKey() => PANEL_KEY;

        protected override void DistributeAdRewards()
        {
            m_GameView.Revive();
        }

        protected override int GetNeedCoins() => BaseDataMgr.Instance.Cfg.level.revivalCost;

        protected override void ClickBtnHandle(string name)
        {
            base.ClickBtnHandle(name);
            if (name.Equals(LevelFailurePanelNotifications.NoThanksBtn_CTRL))
            {
                CloseBtnHandle();
            }
        }

        protected override void CloseBtnHandle()
        {
            UIUtility.DisplayPanel(LevelFailureSettlePanel.LevelFailureSettlePanelView.PANEL_KEY, "UI/LevelFailureSettlePanel/Prefabs/LevelFailureSettlePanel", data: m_GameView);
            base.CloseBtnHandle();
        }
    }
}